package cn.lyh.edu.repository;

import cn.lyh.edu.domain.EduLesson;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 课程持久层
 * @author Administrator
 */
public interface EduLessonRepository extends JpaRepository<EduLesson, Long>, JpaSpecificationExecutor<EduLesson> {
    /**
     * 根据课程id号查询记录
     * @param lessonNumber
     * @return
     */
    EduLesson findByLessonNumber(String lessonNumber);

    /**
     * 根据教师ID获取房间列表
     * @param id
     * @param num
     * @return
     */
    @Query(value = "select * from edu_lesson where teacher_id=?1 LiMIT ?2",nativeQuery = true)
    List<EduLesson> getLessonListByTeacherId(Long id, int num);

}